package com.cloud.freeflow.api.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cloud.freeflow.api.entity.ProcActDef;
import com.cloud.freeflow.api.service.ProcActDefService;
import com.cloud.freeflow.common.result.Quokka;

@RestController
@RequestMapping("freeflow/api/procactdef")
public class ProcActDefController {

	@Autowired
	private ProcActDefService procActDefService;

	@RequestMapping("create")
	public Quokka createProcAct(@RequestBody ProcActDef act) {
		return new Quokka(true, procActDefService.createProcAct(act));
	}

	@RequestMapping("list")
	public Quokka listProcActs(long id) {
		return new Quokka(true, procActDefService.listProcActs(id));
	}

	@RequestMapping("delete")
	public Quokka deleteProcActs(long id) {
		return new Quokka(true, procActDefService.deleteProcAct(id));
	}

	@RequestMapping("move")
	public Quokka move(@RequestBody ProcActDef act) {
		return new Quokka(true, procActDefService.moveProcActs(act));
	}

	@RequestMapping("load")
	public Quokka load(Long actDefId) {
		return new Quokka(true, procActDefService.loadByActDefId(actDefId));
	}

	@RequestMapping("saveupdate")
	public Quokka saveUpdateActDef(@RequestBody ProcActDef actDef) {
		procActDefService.saveUpdateActDef(actDef);
		return new Quokka(true, actDef);
	}
}
